package com.bitin.adorn.demo.model;

import com.fasterxml.jackson.annotation.JsonBackReference;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class Account {

    @Id
    private Long id;

    private BigDecimal balance;

//    @JsonBackReference
//    @OneToOne(optional = false, cascade = CascadeType.ALL, mappedBy = "account")
//    private User user;

    public Account income(BigDecimal income){
        this.balance = getBalance().add(income);
        return this;
    }

//    public Account rname(String name) {
//        this.user.name(name);
//        return this;
//    }
}
